import { createRouter, RouteOption, createWebHashHistory, createWebHistory } from 'vue-router';

// 公共路由
const constantRoutes: RouteOption[] = [
	{
		path: '/',
		component: () => import('@/views/index.vue')
	},
	{
		path: '/v',
		component: () => import('@/views/dcm-view/index.vue')
	},
	{
		path: '/p',
		component: () => import('@/views/report/index.vue')
	}
	,
	{
		path: '/p/t',
		component: () => import('@/views/report/templates/print-preview/index.vue')
	}
];

/**
 * 创建路由 正式环境使用hash路由
 */
const router = createRouter({
	history: import.meta.env.VITE_APP_ENV == 'development' ? createWebHistory(import.meta.env.VITE_APP_CONTEXT_PATH) : createWebHashHistory(import.meta.env.VITE_APP_CONTEXT_PATH),
	routes: constantRoutes
});

export default router;
